import React from 'react';

export default class Decorator {
  constructor(obj) {
    this._strategy = obj.strategy;
    this._component = obj.component;
  }

  render(props, element) {
    if (this._strategy(props)) {
      const Component = this._component;
      return <Component {...props}>{element}</Component>;
    }
    return element;
  }
}
